#ifndef DEF_H
#define DEF_H
#include <QThread>
#include <QSqlDatabase>
#include <QSqlError>
#include <QTcpSocket>
#ifdef WIN32
#include <windows.h>
#endif
#include <QMessageBox>
#include <QTime>
#include <QSqlQueryModel>
#include <QModelIndex>
#include <QList>
#include <QDateTime>
#include <QDebug>
#include <QSettings>
#include <QFile>
#include <QSystemTrayIcon>
#include <QCloseEvent>
#include <QMenu>
#include <QAction>
#include <QStringList>
#include <iostream>
#include <QDateTime>
#include <QMutex>

#include "dohttp.h"


#define SLEEP_TIME 5
#define PI  3.141592657
using namespace  std;


typedef struct
{
    QString ip;
    int port;
    QString theaterNo;
    double fix_ftl;
    double fix_lc;
    double fix_rc;
    double fix_cc;
    double fix_hb;
    double fix_la;
    double fix_ra;
    QTime stime;
    QTime etime;

}Device;

typedef struct
{
    QString db_host;
    int db_port;
    QString db_name;
    QString db_user;
    QString db_pass;

}Config;

typedef struct
{
    double l_fix, ftl_fix, r_fix, c_fix, lfe_fix, ls_fix, rs_fix, ll_fix, rl_fix;
}Fix;


typedef struct
{
    double dcp_gain;
    double lamp_current;
    double lamp_power;
    long darktime;
    long temper;
}AutoTuneDev;

typedef struct
{
    QString ip;
    int port;
    QString type;
}DeviceHost;


typedef struct
{
    double left_std;
    double right_std;
    double center_std;
    double lfe_std;
    double leftSurround_std;
    double rightSurround_std;
}StdValue;

typedef struct
{
    double leftSpl;
    double rightSpl;
    double centerSpl;
    double lfeSpl;
    double leftSurroundSpl;
    double rightSurroundSpl;
}TestSplValue;

typedef struct
{
    double deviation_dcp;
    double deviation_projector;
    double deviation_darktime;
    double deviation_aircondition;
    double enable_dcp;
    bool enable_projector;
    bool enable_darktime;
    bool enable_aircondition;
    double interval_projector;
    double interval_dcp;
    double interval_aircondition;
    double interval_darktime;
    double ref_dcp;
    double ref_projector;
    double ref_darktime;
    double ref_aircondition;
     QString theaterNo;

}AutoTuningParameter;

typedef struct
{
    QString ip;
    int port;
    double screen_gain;
    double screen_width;
    double screen_height;
}AutoDevice;

typedef struct
{
    double x;
    double y;
    double X;
    double Y;
    double Z;
}XYZ;

typedef struct
{
    double rx1;
    double ry1;
    double URX1;
    double URY1;
    double URZ1;

    double gx1;
    double gy1;
    double UgX1;
    double UgY1;
    double UgZ1;

    double bx1;
    double by1;
    double UbX1;
    double UbY1;
    double UbZ1;

    double rx2;
    double ry2;
    double URX2;
    double URY2;
    double URZ2;

    double gx2;
    double gy2;
    double UgX2;
    double UgY2;
    double UgZ2;

    double bx2;
    double by2;
    double UbX2;
    double UbY2;
    double UbZ2;
    QString theaterNo;
}Laser;

//QString read_data(char *s, QTcpSocket &socket)
//{
//       char buf[50];
//       socket.write(s, strlen(s));
//       if(!socket.waitForBytesWritten())
//           throw socket.errorString();
//       memset(buf, 0, 50);
//       if (!socket.waitForReadyRead())
//           throw socket.errorString();
//       socket.read(buf, 50);
//       return QString::fromLocal8Bit(buf);
//}


#endif // DEF_H
